<!--
 * @Description: 1
 * @Version: 1.0
 * @Autor: haozhuang
 * @Date: 2020-04-28 15:26:45
 * @LastEditors: haozhuang
 * @LastEditTime: 2020-05-06 15:36:00
 -->
<template>
  <div class="app-container">
    <div id="minder-container" />
  </div>
</template>

<script>
// import kity from 'kity'
// import kityminder from 'kityminder-core'
export default {
  data() {
    return {}
  },
  watch: {
    filterText(val) {
      this.$refs.tree2.filter(val)
    }
  },
  mounted() {
    this.km = new window.kityminder.Minder({
      renderTo: '#minder-container'
    })
    this.km.importJson({
      root: {
        data: {
          text: 'test111'
        },
        children: [
          { data: { text: '新闻\nsrc/module/node.j' }},
          { data: { text: '网页' }},
          { data: { text: '贴吧' }},
          { data: { text: '知道' }},
          { data: { text: '音乐' }},
          { data: { text: '图片' }},
          { data: { text: '视频' }},
          { data: { text: '地图' }},
          { data: { text: '百科', expandState: 'collapse' }}
        ]
      },
      template: 'default'
    })
  },
  methods: {
    filterNode(value, data) {
      if (!value) return true
      return data.label.indexOf(value) !== -1
    }
  }
}
</script>
<style lang="scss" scoped>
.app-container,
#minder-container {
  height: 100vh;
}
</style>
